/-app
/-app/boot
/-app/layout
/-app/layout/loading
/-app/layout/managed
AssemblyDetails.html
MethodInfo.html
Type.html
page.css
page.html
/-app/layout/tree
/-app/layout/unmanaged
app.css
commonPage.css
pe.css
pefile.html
/-app/loaded
/-app/loading
/-app/mscorlib
Application.ts
earlyinit.js
format.ts
functions.ts
ko.ts
lateinit.js
/-core
/-headers
/-imports
/-io
/-managed ...
/-managed/metadata
/-managed/metadata/enums
ClrDirectory.ts
ClrMetadata.ts
CodedIndexReader.ts
MetadataStreams.ts
TableCompletionReader.ts
TableReader.ts
TableStream.ts
bits.ts
/-managed/tables
Assembly.ts
AssemblyOS.ts
AssemblyProcessor.ts
AssemblyRef.ts
AssemblyRefOS.ts
AssemblyRefProcessor.ts
ClassLayout.ts
Constant.ts
CustomAttribute.ts
DeclSecurity.ts
Event.ts
EventMap.ts
ExportedType.ts
Field.ts
FieldLayout.ts
FieldMarshal.ts
FieldRva.ts
File.ts
GenericParam.ts
GenericParamConstraint.ts
ImplMap.ts
InterfaceImpl.ts
ManfiestResource.ts
MemberRef.ts
MethodDef.ts
MethodImpl.ts
MethodSemantics.ts
MethodSpec.ts
Module.ts
ModuleRef.ts
NestedClass.ts
Param.ts
Property.ts
PropertyMap.ts
StandaloneSig.ts
TypeDef.ts
TypeRef.ts
TypeSpec.ts
AppDomain.ts
Assembly.ts
ConstructedGenericType.ts
EventInfo.ts
FieldInfo.ts
MethodInfo.ts
ParameterInfo.ts
PropertyInfo.ts
Type.ts
TypeReference.ts
/-typings
/-unmanaged
pe.html
pe.ts
70
      asm.version = version;
71
      asm.publicKey = publicKey;
72
      asm.culture = culture;
73
      return asm;
74
    }
75
  }
76
 
77
 
78
  class AssemblyReading {
79
    fileHeaders: headers.PEFileHeaders = null;
80
    clrDirectory: metadata.ClrDirectory = null;
81
    clrMetadata: metadata.ClrMetadata = null;
82
    metadataStreams: metadata.MetadataStreams = null;
83
    tableStream: metadata.TableStream = null;
84
 
85
    private _stage = 0;
86
 
87
    constructor(
88
      public appDomain: AppDomain,
89
      private _reader: io.BufferReader,
90
      private _async: AsyncCallback<Assembly>) {
91
    }
92
 
93
    read(): Assembly {
94
 
95
      var stageCount = 0;
96
 
97
      switch (this._stage) {
98
        case 0:
99
          this._reader.offset = 0;
100
          this.readFileHeaders();
101
          if (this._progressContinueLater()) return;
102
 
103
        case 1:
104
          this.readClrDirectory();
105
          if (this._progressContinueLater()) return;
106
 
107
        case 2:
108
          this.readClrMetadata();
109
          if (this._progressContinueLater()) return;
110
 
111
        case 3:
112
          this.readMetadataStreams();
113
          if (this._progressContinueLater()) return;
114
 
115
        case 4:
116
          this.readTableStream();
117
          if (this._progressContinueLater()) return;
118
 
119
        case 5:
120
          this.populateStrings(this.tableStream.stringIndices);
121
          if (this._progressContinueLater()) return;
122
 
123
        case 6:
124
          var mscorlib = this._getMscorlibIfThisShouldBeOne();
125
          if (mscorlib)
126
            this.tableStream.tables[metadata.TableKind.Assembly][0].def = mscorlib;
127
          if (this._progressContinueLater()) return;
128
 
129
        case 7:
130
          this.completeTables();
131
          if (this._progressContinueLater()) return;
132
 
133
        case 8:
134
          var result = this._createAssemblyFromTables();
135
          result.fileHeaders = this.fileHeaders;
136
          if (this._async)
137
            this._async(null, result);
138
          else
139
            return result;
140
      }
141
    }
142
 
143
    private _progressContinueLater() {
144
      this._stage++;
145
      if (this._async && this._async.progress) {
146
        var continueLater = this._async.progress(this._stage, 9);
147
        if (continueLater) {
148
          continueLater(() => this.read());
149
          return true;
150
        }
151
      }
152
 
153
      return false;
154
    }